class SweetPotato:
    def __init__(self):
        self.time=0
        self.status='生的'
        self.condiment=[]
    def cook(self,time):
        self.time+=time
        if (0<=self.time<=3):
            self.status='生的'
        elif (3<=self.time<5):
            self.status='半生不熟'
        elif (5<=self.time<8):
            self.status='熟的'
        elif (self.time>=8):
            self.status='糊了'

    def add(self,condiment):

            self.condiment.append(condiment)
    def __str__(self):
        return f'煮了{self.time}分钟，状态为{self.status},添加的佐料有{self.condiment}'
if __name__=='__main__':
    # 创建对象，自动调用__init__函数
    sp1 = SweetPotato()
    sp1.cook(2)
    sp1.add('酱油')
    print(sp1)
    sp1.cook(5)
    sp1.add('牛奶')
    print(sp1)

